<script>
import outMain from "@/components/outMain.vue";
import { ElMessage, ElMessageBox } from "element-plus";
import { lzList } from "@/http/api";

export default {
  components: { outMain },
  name: "",
  data() {
    return {
      tableData: [],

      queryData: {
        qy_real_name: "",
        qy_staff_name: "",
        page: 1,
        per_page: 20,
      },
      total: 0,
    };
  },
  props: {},
  setup() {},
  methods: {
    detailFn(row) {
      this.$router.push({
        path: "/bootSignDetail",
        query: { id: row.cy_sign_id, page: this.queryData.page },
      });
    },
    async getData() {
      this.queryData.page = Number(localStorage.getItem("boot_page")) || 1;

      const { data } = await lzList(this.queryData);
      if (data.code == 1) {
        this.tableData = data.data.data;
        this.total = data.data.total;
      }
    },
  },
  mounted() {},
  created() {
    this.getData();
  },
};
</script>
<template>
  <outMain>
    <div class="tableCont">
      <div class="tableName flexCont">
        <div>离职船员（{{ total }}）</div>
      </div>
      <div class="tableSerch">
        <div class="serchLeft"></div>
        <div class="serchRight">
          <el-form class="flexCenter" :inline="true">
            <el-form-item>
              <el-input
                clearable
                @clear="getData"
                @keyup.enter="getData"
                v-model="queryData.qy_real_name"
                placeholder="请输入船员姓名"
              />
            </el-form-item>
            <el-form-item>
              <el-input
                clearable
                @clear="getData"
                @keyup.enter="getData"
                v-model="queryData.qy_staff_name"
                placeholder="请输入操作员工姓名"
              />
            </el-form-item>
            <btn value="搜索" @click="getData"></btn>
          </el-form>
        </div>
      </div>
      <el-table class="tableMain" :data="tableData" stripe style="width: 100%">
        <el-table-column
          prop="qy_real_name"
          show-overflow-tooltip
          label="船员姓名"
        />
        <el-table-column
          prop="qy_position_name"
          show-overflow-tooltip
          label="离职岗位"
        />
        <el-table-column
          prop="qy_enterprise_name"
          show-overflow-tooltip
          label="船东公司"
          width="250"
        />

        <el-table-column
          prop="lz_time"
          show-overflow-tooltip
          width="200"
          label="离职时间"
        />
        <el-table-column
          prop="lz_reason"
          show-overflow-tooltip
          label="离职原因"
        />
        <el-table-column
          prop="lz_cz_staff"
          show-overflow-tooltip
          label="操作员工"
        />

        <el-table-column prop="Name" width="80" label="操作">
          <template #default="{ row }">
            <div class="tableCtrl">
              <div class="greenText ctrlText" @click="detailFn(row)">详情</div>
            </div>
          </template>
        </el-table-column>
      </el-table>
      <div class="pageCont">
        <el-pagination
          v-model:currentPage="queryData.page"
          v-model:page-size="queryData.per_page"
          background
          layout="total, prev, pager, next, jumper"
          :total="total"
          @size-change="getData"
          @current-change="getData"
        />
      </div>
    </div>
  </outMain>
</template>
<style scoped lang="less"></style>
